#ifndef _OI_PLSCANNERDLL_RECORDPAGE_HPP_
#define _OI_PLSCANNERDLL_RECORDPAGE_HPP_

#include "OiPageAbstract.hpp"

namespace Oi
{
    namespace PLScannerDll
    {
        class MonthSelectWidget : public QWidget
        {
            Q_OBJECT

        public:
            MonthSelectWidget(QWidget* parent = nullptr);
            QDate month() const;

        signals:
            void monthChanged(const QDate);

        public slots:
            void setMouth(const QDate);

            private slots:
            void onSelectedChanged();

        private:
            OI_DECLARE_IMPL(MonthSelectWidget);
            OI_DISABLE_COPY(MonthSelectWidget);
        };

        class statisticsTimeDlg : public QDialog
        {
            Q_OBJECT

        public:
            statisticsTimeDlg(QWidget* parent = nullptr);

        private slots:
            void updateMonth(QDate dt);

        private:
            OI_DECLARE_IMPL(statisticsTimeDlg);
            OI_DISABLE_COPY(statisticsTimeDlg);
        };

        class statisticsRatioDlg : public QDialog
        {
            Q_OBJECT

        public:
            statisticsRatioDlg(QWidget* parent = nullptr);

            private slots:
            void updateTime();
            void onExport();

        private:
            OI_DECLARE_IMPL(statisticsRatioDlg);
            OI_DISABLE_COPY(statisticsRatioDlg);
        };

        class statisticsValueDlg : public QDialog
        {
            Q_OBJECT

        public:
            statisticsValueDlg(QWidget* parent = nullptr);
            void setFilter(QDateTime from, QDateTime end, int classes, QString formular);

        private slots:
            void updateTable();

        private:
            OI_DECLARE_IMPL(statisticsValueDlg);
            OI_DISABLE_COPY(statisticsValueDlg);
        };

        class xrGraphicDlg : public QDialog
        {
            Q_OBJECT

        public:
            xrGraphicDlg(QWidget* parent = nullptr);

        private slots:
            void update();

        private:
            OI_DECLARE_IMPL(xrGraphicDlg);
            OI_DISABLE_COPY(xrGraphicDlg);
        };

        class RecordPage : public PageAbstract
        {
            Q_OBJECT

        public:
            RecordPage(QWidget * parent = nullptr);

        public slots:
            void onCategoryChanged(int);
            void setCategoryIndex(int);
            void updateFormuala();
            void updateUser();
            void updateResult();
            void updateOrder();
            void onTableDoubleClicked(const QModelIndex &);
            void deleteItem(const QPoint& pos);

        public slots:
            void xrGraphics();
            void update();
            void exportExcel();
            void statisticsTime();
            void statisticsRatio();
            void statisticsData();

        public:
            void setParams(const PLScannerCore::ProductParams& params) {}
            int setResult(const PLScannerCore::WorkResult::Result& result) { return 0; }

            void setRun(bool flag) {}
            void toCurrent() {}
            void updatePermission();

        protected:
            void showEvent(QShowEvent *event);

        private:
            OI_DECLARE_IMPL(RecordPage);
            OI_DISABLE_COPY(RecordPage);

//         public:
//             static void calCPCPK(QList<double> values, double& cp, double& cpk, const double tolMax, const double tolMin);
//             static void calFPY(QList<int> values, double& okRatio);
        };
    }
}

#endif

